<!DOCTYPE html>
<html>
    <head>
      <script src="../jquery-3.5.0.min.js"></script>
      <script src="showModalDialog.js"></script>
      <script src="common.js"></script>
      <title>test2</title>
    </head>
    <body>
      <form action="">
        <p>Dialog argments: 
          <span id="arg1"></span>
          <span id="arg2"></span>
        </p>
        <p>
          <button id="button" type="button" value="" onclick="show()"> 打开modal test3</button>
          <button id="button" type="button" value="" onclick="closeModal()"> 关闭modal</button>
          <br>
          <span id="result"></span>
        </p>
      </form>
      <script>
        document.getElementById('arg1').innerHTML = window.dialogArguments.name;
        document.getElementById('arg2').innerHTML = window.dialogArguments.value;
        window.returnValue = "value from test2";
      </script>
      <script>
        //using async/await
        async function show(){
          console.log('show test2')
          let params = 'test2'
          let options = {
            width : 1000,
            height:1000,
            resizable:true
          }
          let res = await showModal('test3.html',options,params);
          console.log("test2: " +res)
          document.getElementById('result').innerText = "test2: " + res;
        }
      </script>
    </body>
</html>
